package com.zw.sample;

/**
 * http://igoro.com/archive/gallery-of-processor-cache-effects/
 * @author zhaowei1
 *
 */

public class Test {
public static void main(String[] args) {
	int[] arr = new int[64 * 1024 * 1024];

	
	int[] K = new int[]{1, 2, 4, 8, 16, 32, 64, 128};
	for (int p=0; p < K.length; p++) {
		long time = System.currentTimeMillis();
		for (int i = 0; i < arr.length; i += K[p]){
			arr[i] += 3;
		}
		System.out.println("K is " + K[p] + "; Use time : " + 
				( System.currentTimeMillis() - time ));
	}
}
}
